<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>登录</title>
<link href="script/bootstrap/css/bootstrap.css" rel="stylesheet" type="text/css" media="screen">
<link type="text/css" rel="stylesheet" href="script/css/header.css">
<link type="text/css" rel="stylesheet" href="script/css/login.css">
<script src="script/bootstrap/js/jquery-1.8.2.js"></script>
<script src="script/bootstrap/js/bootstrap.js"></script>
</head>
<body>
	<div id="header">
		<div class="container">
			<ul class="nav nav-pills pull-right tnav-menu" style="margin:18px auto;">
				<li><a href="register.html">注册</a></li>
				<li><a href="advice.html">给我们提建议</a></li>
			</ul>
			<h1>
				<a title="糊涂账" href="login.html"> 
					<img width="154" height="49" src="script/img/logo3.png" title="糊涂账" alt="一起来记流水帐">
					</img>
				</a>
			</h1>
		</div>
	</div>
	<div id="main">
		<div class="container">
			<div class="row">
				<div id="loginPanel" class="span3">
					<form id="loginForm" class="tloginForm">
						 <div>
						 	<span id="errMsg"></span>
						 </div>
						 <div class="input-prepend">
							<span class="add-on"><i class="icon-user"></i></span>
							<input type="text" id="inputEmail" name="email" placeholder="请输入邮箱">
						</div>
						<div class="input-prepend">
							<span class="add-on"><i class="icon-lock"></i></span>
							<input type="password" id="inputPassword" name="password" placeholder="请输入密码">
						</div>
						<div>
							<input id="inputforgetPWD" type="button" class="btn btn-link" value="忘记密码？">
							<label class="checkbox" id="autoLoginLabel">
								<input id="inputAutoLoginCkb" name="autoLogin" value="1" type="checkbox">下次自动登录
							</label>
						</div>
						<input id="loginBtn" type="button" class="btn btn-block btn-primary" value="登  录">
					</form>
					<div style="padding: 0px 10px;">
						<input id="regBtn" type="button" class="btn btn-block btn-success" value="注  册">
					</div>
				</div>
				<div id="mainPanel" class="span9" >
					<div style="padding: 35px 10px 5px;">
						<div class="hero-unit">
    						<h1>Heading</h1>
    						<p>Tagline</p>
    						<p>
    							<a class="btn btn-primary btn-large">
    								Learn more
    							</a>
    						</p>
    					</div>
    				 </div>
				 </div>
			</div>
		</div>
	</div>
</body>
</html>

<script type="text/javascript">
$(document).ready(function(){
	$("#regBtn").click(function() {
		window.location.href="register.html";
	});
	
	$("#loginBtn").click(function(){
		if($("#inputEmail").val()=="") {
			$("#errMsg").text("登录邮箱不能为空！");
			$("#errMsg").show();
			return false;
		};
		
		if($("#inputPassword").val()=="") {
			$("#errMsg").text("登录密码不能为空！");
			$("#errMsg").show();
			return false;
		};
		
		$.ajax({
			type: "POST",
			url: "LoginAuth",
			data: $("#loginForm").serialize(),
			dataType: "json",
			success: function(data, textStatus) {
				if(data.success == true) {
					alert("登录成功！");
					window.location.href="account.html";
				} else {
					alert(data.msg);
					$("#inputPassword").val("");
				}
			}
		});
	});
});
</script>